import java.util.ArrayList;
import java.util.Iterator;

public class list1 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(50);
        for (Integer i : list) {
            System.out.println(i);

        }
        System.out.println("------------------");
        Iterator<Integer> iterator = list.iterator();
        while (iterator.hasNext()) {
            Integer next = iterator.next();
            System.out.println(next);
        }
        ;
        System.out.println("------------------");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        ;
        System.out.println("------------------");
    }
}
